python2 := python
rpython := $(python2) ~/opt/pypy/rpython/bin/rpython --batch

zexjit: z80.py
	$(rpython) --translation-jit --gc=minimark zextests.py

zex0: z80.py
	$(rpython) -O0 --gc=none zextests.py

zex1: z80.py
	$(rpython) -O1 --gc=none zextests.py

zex2: z80.py
	$(rpython) -O2 --gc=none zextests.py

zex3: z80.py
	$(rpython) -O3 --gc=none zextests.py

z80.py: z80th.py z80bh.py
	cat z80th.py > z80.py
	cat z80bh.py >> z80.py

z80bh.py: z80gen.py
	$(python2) ./z80gen.py -o $@

clean:
	-rm *.pyc
	-rm z80bh.py
	-rm z80.py
	-rm zextests-c
